﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Data;
using System.Data.SqlClient;

/// <summary>
/// Summary description for YeuCauSuaChuaIT
/// </summary>
public class YeuCauSuaChuaIT
{
	public YeuCauSuaChuaIT()
	{
	}

    private string _nguoiYC;

    public string NguoiYC
    {
        get { return _nguoiYC; }
        set { _nguoiYC = value; }
    }

    private string _loaiYC;

    public string LoaiYC
    {
        get { return _loaiYC; }
        set { _loaiYC = value; }
    }
    private string _noidung;

    public string Noidung
    {
        get { return _noidung; }
        set { _noidung = value; }
    }
    private string _mamay;

    public string Mamay
    {
        get { return _mamay; }
        set { _mamay = value; }
    }

    private string _maytinh;

    public string Maytinh
    {
        get { return _maytinh; }
        set { _maytinh = value; }
    }
    public DataTable LoadDanhSachLoaiYC()
    {
        string procName = "cv_LoaiYeuCauSuaChua";
        DataService ds = new DataService();
        ds.Connect();
        DataTable table = ds.ExcuteProcedureGetTable(procName, null);
        ds.Disconnect();
        return table;       
    }

    public int LapPhieuYCSuaChua()
    {
        string procName = "cv_LapPhieuYeuCauSuaChua";
        DataService ds = new DataService();
        ds.Connect();
        SqlParameter[] parameters = new SqlParameter[6];
        parameters[0] = new SqlParameter("@ngayyc", DateTime.Now);
        parameters[1] = new SqlParameter("@nguoiyc", NguoiYC);
        parameters[2] = new SqlParameter("@loaiyc", LoaiYC);
        parameters[3] = new SqlParameter("@noidung", Noidung);
        parameters[4] = new SqlParameter("@mamay", Mamay);
        parameters[5] = new SqlParameter("@maytinh", Maytinh);
        int i =ds.ExcuteProcedureWithReturn(procName, parameters);
        return i;
    }

    public DataTable KiemTraMayTinhTrongHeThong()
    {
        string procName = "mt_kiemtramaytinh";
        DataService ds = new DataService();
        ds.Connect();
        SqlParameter[] parameters = new SqlParameter[1];
        parameters[0] = new SqlParameter("@mamay", Mamay);
        DataTable table = ds.ExcuteProcedureGetTable(procName, parameters);
        ds.Disconnect();
        return table;
    }
}